export default {
  methods: {
    getPermission (func) {
      let menus = this.$store.state.me.menus
      let result = ''
      function dynamicMenu (menus) {
        for (let i in menus) {
          if (menus[i].children.length) {
            dynamicMenu(menus[i].children)
          } else {
            if (menus[i].buttons.length) {
              dynamicMenu(menus[i].buttons)
            }
          }
          if (menus[i].functionCode === func) {
            result = menus[i].functionCode
            return false
          }
        }
      }
      dynamicMenu(menus)
      return result
    }
  }
}
